
NAMESPACE_BEGIN(interp)

template <class EncodingT>
shared_ptr< Base<EncodingT> > StringConstant<EncodingT>::interpret(Context<EncodingT> & c)
{
    return shared_ptr< Base<EncodingT> >(new String<EncodingT>(m_data));
}

template <class EncodingT>
bool StringConstant<EncodingT>::parse(typename EncodingT::string_t const& buf, shared_ptr< Term<EncodingT> > & value)
{  
    typename EncodingT::string_t expr = eat_space<EncodingT>(buf);
    bool success =  expr.size()>1 &&
                    expr[0] == (typename EncodingT::char_t)'\"' &&
                    expr[expr.size()-1] == (typename EncodingT::char_t)'\"';
    if (success)
    {
        value.reset(new StringConstant<EncodingT>(typename EncodingT::string_t(expr.begin()+1, expr.end()-1)));
    }
    return success; 
}

NAMESPACE_END
